import {View, Text, StyleSheet} from 'react-native'
import React, {Component} from 'react'
import Picker from 'react-native-picker';

interface PickerOption<T> {
    onPickerConfirm: (data: T[]) => void,
    selectedValue: T[],
    pickerData: Array<T>,
    onPickerSelect?: (data: T[]) => void,
    onPickerCancel?: (data: T[]) => void,
}

export default function showPicker<T>(option: PickerOption<T>) {
    Picker.init({
        pickerConfirmBtnText: "确定",
        pickerCancelBtnText: "取消",
        pickerTitleText: "",
        pickerCancelBtnColor: [204, 35, 35, 1],
        pickerBg: [255, 255, 255, 1],
        pickerToolBarBg: [251, 251, 251, 1],
        ...option
    });
    Picker.show();
}

export function hidePicker() {
    Picker.hide();
}